package com.shrct.businessprocess;

import com.google.common.base.Objects;
import com.shrct.businessprocess.budget.RCBudget;
import com.shrct.businessprocess.common.CurrencyType;
import com.shrct.businessprocess.customerservice.RCFaultReport;
import com.shrct.businessprocess.customerservice.RCProjectReference;
import com.shrct.businessprocess.customerservice.RCTimeLevel;
import com.shrct.businessprocess.organization.RCEmployee;
import com.shrct.businessprocess.organization.RCEnterprise;
import com.shrct.businessprocess.product.RCIdentifiableProductEntry;
import com.shrct.businessprocess.product.RCServiceLevel;
import com.shrct.businessprocess.product.impl.RCServiceLevelImpl;
import com.shrct.businessprocess.project.RCCommissionYearConfig;
import com.shrct.businessprocess.project.RCCustomerContract;
import com.shrct.businessprocess.project.RCExchangeRate;
import com.shrct.businessprocess.project.RCParameterService;
import com.shrct.businessprocess.project.RCProject;
import com.shrct.businessprocess.project.RCProjectCreditStat;
import com.shrct.businessprocess.project.RCProjectMoney;
import com.shrct.businessprocess.project.RCProjectServiceDeliver;
import com.shrct.businessprocess.project.RCProjectStat;
import com.shrct.businessprocess.project.RCProjectTypeExtension;
import com.shrct.businessprocess.project.RCProjectTypeExtensionDAO;
import com.shrct.businessprocess.project.RCRealMoney;
import com.shrct.businessprocess.project.RCSaleCommissionYearPayment;
import com.shrct.businessprocess.project.RCSalesAssignment;
import com.shrct.businessprocess.project.RCSalesCommissionYearConfig;
import com.shrct.businessprocess.project.impl.RCSaleCommissionYearPaymentImpl;
import com.shrct.businessprocess.purchase.RCBasePurchaseOrder;
import com.shrct.businessprocess.purchase.RCIdentifiableProductInStockEvent;
import com.shrct.businessprocess.purchase.RCPayRequest;
import com.shrct.businessprocess.purchase.RCPurchaseOrder;
import com.shrct.businessprocess.purchase.RCPurchaseOrderInvoice;
import edu.fudan.langlab.domain.security.AppFunction;
import edu.fudan.langlab.domain.security.AppFunctionService;
import edu.fudan.langlab.domain.security.impl.AppFunctionImpl;
import edu.fudan.langlab.domain.updater.IUpgrader;
import edu.fudan.langlab.domain.updater.UpdateServie;
import edu.fudan.langlab.domain.workflow.Activity;
import edu.fudan.langlab.domain.workflow.BusinessProcess;
import edu.fudan.langlab.domain.workflow.IHasProcess;
import edu.fudan.mylang.pf.BaseService;
import edu.fudan.mylang.pf.IGenericQuery;
import edu.fudan.mylang.pf.IObjectFactory;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.InputOutput;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.stereotype.Service;

@Service("V_0_2")
public class V_0_2 extends BaseService implements IUpgrader {
  @Autowired
  private HibernateTransactionManager txm;
  
  @Autowired
  private IObjectFactory entities;
  
  @Autowired
  private RCProjectTypeExtensionDAO projectTypeExtensionDAO;
  
  @Autowired
  private AppFunctionService appFunctionService;
  
  @Autowired
  private RCParameterService parameterService;
  
  public void setRCIdentifiableProductInStockEventQuantityTo1() {IGenericQuery<RCIdentifiableProductInStockEvent> query=getObjectFactory().createGenericQuery(RCIdentifiableProductInStockEvent.class,"select e from com.shrct.businessprocess.purchase.impl.RCIdentifiableProductInStockEventImpl as e   where  e.active = 1      ");
    Collection<RCIdentifiableProductInStockEvent> _list = query.list();
    final Procedure1<RCIdentifiableProductInStockEvent> _function = new Procedure1<RCIdentifiableProductInStockEvent>() {
        public void apply(final RCIdentifiableProductInStockEvent it) {
          it.setQuantity(Integer.valueOf(1));
        }
      };
    IterableExtensions.<RCIdentifiableProductInStockEvent>forEach(_list, _function);
  }
  
  public void setIdentifiableProductCountTo1() {IGenericQuery<RCIdentifiableProductEntry> query=getObjectFactory().createGenericQuery(RCIdentifiableProductEntry.class,"select e from com.shrct.businessprocess.product.impl.RCIdentifiableProductEntryImpl as e   where  e.active = 1      ");
    Collection<RCIdentifiableProductEntry> _list = query.list();
    final Procedure1<RCIdentifiableProductEntry> _function = new Procedure1<RCIdentifiableProductEntry>() {
        public void apply(final RCIdentifiableProductEntry it) {
          it.setCount(Integer.valueOf(1));
        }
      };
    IterableExtensions.<RCIdentifiableProductEntry>forEach(_list, _function);
  }
  
  public void initTaxRate() {
    IGenericQuery<RCBasePurchaseOrder> query=getObjectFactory().createGenericQuery(RCBasePurchaseOrder.class,"select e from com.shrct.businessprocess.purchase.impl.RCBasePurchaseOrderImpl as e   where (e.taxRate IS   NULL ) and  e.active = 1      ");
    Collection<RCBasePurchaseOrder> _list = query.list();
    final Procedure1<RCBasePurchaseOrder> _function = new Procedure1<RCBasePurchaseOrder>() {
        public void apply(final RCBasePurchaseOrder it) {
          it.setTaxRate(Double.valueOf(0d));
        }
      };
    IterableExtensions.<RCBasePurchaseOrder>forEach(_list, _function);
  }
  
  public void functions20150420() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.process");
          it.setFunctionId("com.shrct.businessprocess.web.ShowProjectACTSummaryManagementCommand");
          it.setName("\u9879\u76EE\u6C47\u603B\u4FE1\u606F\u67E5\u8BE2");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);
  }
  
  public void remainAmount() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.process");
          it.setFunctionId("com.shrct.businessprocess.web.ShowProjectRemainAmountManagementCommand");
          it.setName("\u9879\u76EE\u9884\u7559\u8D39\u7528\u67E5\u8BE2");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);AppFunction appFunction_1=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_1 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.process");
          it.setFunctionId("com.shrct.businessprocess.web.ShowMyProjectRemainAmountManagementCommand");
          it.setName("\u6211\u7684\u9884\u7559\u8D39\u7528\u67E5\u8BE2");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_1, _function_1);
  }
  
  public void RCProjectReference() {IGenericQuery<RCProjectReference> query=getObjectFactory().createGenericQuery(RCProjectReference.class,"select e from com.shrct.businessprocess.customerservice.impl.RCProjectReferenceImpl as e   where  e.active = 1      ");
    Collection<RCProjectReference> _list = query.list();
    final Procedure1<RCProjectReference> _function = new Procedure1<RCProjectReference>() {
        public void apply(final RCProjectReference it) {
          it.updateBusinessMan();
          it.updateMajorSales();
        }
      };
    IterableExtensions.<RCProjectReference>forEach(_list, _function);
  }
  
  public void SalesFunction() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setFunctionId("com.shrct.businessprocess.web.saleCommission");
          it.setName("\u4F63\u91D1\u7BA1\u7406");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);
  }
  
  public void invoiceToRealMoney1() {IGenericQuery<RCPurchaseOrderInvoice> query=getObjectFactory().createGenericQuery(RCPurchaseOrderInvoice.class,"select e from com.shrct.businessprocess.purchase.impl.RCPurchaseOrderInvoiceImpl as e   where  e.active = 1      ");
    Collection<RCPurchaseOrderInvoice> _list = query.list();
    final Procedure1<RCPurchaseOrderInvoice> _function = new Procedure1<RCPurchaseOrderInvoice>() {
        public void apply(final RCPurchaseOrderInvoice it) {
          RCRealMoney _rCRealMoney = new RCRealMoney();
          it.setRealAmount(_rCRealMoney);
          RCRealMoney _realAmount = it.getRealAmount();
          RCProjectMoney _amount = it.getAmount();
          Double _amount_1 = _amount.getAmount();
          _realAmount.setAmount(_amount_1);
          RCRealMoney _realAmount_1 = it.getRealAmount();
          RCProjectMoney _amount_2 = it.getAmount();
          RCExchangeRate _exchange = _amount_2.getExchange();
          CurrencyType _currencyType = _exchange.getCurrencyType();
          _realAmount_1.setCurrencyType(_currencyType);
          RCRealMoney _realAmount_2 = it.getRealAmount();
          RCProjectMoney _amount_3 = it.getAmount();
          RCExchangeRate _exchange_1 = _amount_3.getExchange();
          Double _rate = _exchange_1.getRate();
          _realAmount_2.setExchangeRate(_rate);
        }
      };
    IterableExtensions.<RCPurchaseOrderInvoice>forEach(_list, _function);
  }
  
  public void RCPayRequestInfoUpdate1() {IGenericQuery<RCPayRequest> query=getObjectFactory().createGenericQuery(RCPayRequest.class,"select e from com.shrct.businessprocess.purchase.impl.RCPayRequestImpl as e   where  e.active = 1      ");
    Collection<RCPayRequest> _list = query.list();
    final Procedure1<RCPayRequest> _function = new Procedure1<RCPayRequest>() {
        public void apply(final RCPayRequest request) {
          RCBudget _budget = request.getBudget();
          request.setThebudget(_budget);
          if ((request instanceof IHasProcess)) {
            BusinessProcess _process = ((IHasProcess) request).getProcess();
            Collection<Activity> _activities = _process.getActivities();
            final Function1<Activity,Date> _function = new Function1<Activity,Date>() {
                public Date apply(final Activity it) {
                  Date _executeDate = it.getExecuteDate();
                  return _executeDate;
                }
              };
            List<Activity> _sortBy = IterableExtensions.<Activity, Date>sortBy(_activities, _function);
            final Activity startActivity = IterableExtensions.<Activity>head(_sortBy);
            boolean _notEquals = (!Objects.equal(startActivity, null));
            if (_notEquals) {
              Date _executeDate = startActivity.getExecuteDate();
              request.setTheStartDate(_executeDate);
            }
          }
        }
      };
    IterableExtensions.<RCPayRequest>forEach(_list, _function);
  }
  
  public void addFunction20150525() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.process");
          it.setFunctionId("com.shrct.businessprocess.web.ShowProjectProcessEventManagementCommand");
          it.setName("\u4EFB\u52A1\u72B6\u6001\u67E5\u8BE2");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);AppFunction appFunction_1=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_1 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.process");
          it.setFunctionId("com.shrct.businessprocess.web.ShowPayRequestManagementCommand");
          it.setName("\u4ED8\u6B3E\u8BB0\u5F55\u67E5\u8BE2");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_1, _function_1);AppFunction appFunction_2=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_2 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.process");
          it.setFunctionId("com.shrct.businessprocess.web.ShowPurchaseIncomeRequestManagementCommand");
          it.setName("\u5F00\u7968\u8BB0\u5F55\u67E5\u8BE2");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_2, _function_2);
  }
  
  public void allTaskDelivered() {IGenericQuery<RCProject> query=getObjectFactory().createGenericQuery(RCProject.class,"select e from com.shrct.businessprocess.project.impl.RCProjectImpl as e   where  e.active = 1      ");
    Collection<RCProject> _list = query.list();
    final Procedure1<RCProject> _function = new Procedure1<RCProject>() {
        public void apply(final RCProject it) {
          it.setAllTaskDelivered(Boolean.valueOf(false));
        }
      };
    IterableExtensions.<RCProject>forEach(_list, _function);
  }
  
  public void RCFaultReportLevel() {IGenericQuery<RCFaultReport> query=getObjectFactory().createGenericQuery(RCFaultReport.class,"select e from com.shrct.businessprocess.customerservice.impl.RCFaultReportImpl as e   where  e.active = 1      ");
    Collection<RCFaultReport> _list = query.list();
    final Procedure1<RCFaultReport> _function = new Procedure1<RCFaultReport>() {
        public void apply(final RCFaultReport it) {
          it.setTimeLevel(RCTimeLevel.level96h);
        }
      };
    IterableExtensions.<RCFaultReport>forEach(_list, _function);
  }
  
  public void finishDeliverFunction() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.projectManagement");
          it.setFunctionId("com.shrct.businessprocess.web.CreateAllTaskDeliveredDataCommand");
          it.setName("\u5B8C\u6210\u4EA4\u4ED8");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);
  }
  
  public void creditStat4CurrentSalerCommandFunction() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.employeeManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.CreditStat4CurrentSalerCommand");
          it.setName("\u6211\u7684\u9500\u552E\u4FE1\u606F");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);
  }
  
  public void RCProjectReference4CustomerReference() {IGenericQuery<RCProjectReference> query=getObjectFactory().createGenericQuery(RCProjectReference.class,"select e from com.shrct.businessprocess.customerservice.impl.RCProjectReferenceImpl as e   where  e.active = 1      ");
    Collection<RCProjectReference> _list = query.list();
    final Procedure1<RCProjectReference> _function = new Procedure1<RCProjectReference>() {
        public void apply(final RCProjectReference it) {
          RCCustomerContract _customerContract = it.getCustomerContract();
          RCEnterprise _customer = _customerContract.getCustomer();
          it.setCustomer(_customer);
        }
      };
    IterableExtensions.<RCProjectReference>forEach(_list, _function);
  }
  
  public void RCSalesCommissionYearConfigLastSettlement() {IGenericQuery<RCSalesCommissionYearConfig> query=getObjectFactory().createGenericQuery(RCSalesCommissionYearConfig.class,"select e from com.shrct.businessprocess.project.impl.RCSalesCommissionYearConfigImpl as e   where  e.active = 1      ");
    Collection<RCSalesCommissionYearConfig> _list = query.list();
    final Procedure1<RCSalesCommissionYearConfig> _function = new Procedure1<RCSalesCommissionYearConfig>() {
        public void apply(final RCSalesCommissionYearConfig it) {
          it.setLastSettlement(null);
        }
      };
    IterableExtensions.<RCSalesCommissionYearConfig>forEach(_list, _function);
  }
  
  public void LOR_1() {IGenericQuery<RCProject> query=getObjectFactory().createGenericQuery(RCProject.class,"select e from com.shrct.businessprocess.project.impl.RCProjectImpl as e   where  e.active = 1      ");
    Collection<RCProject> _list = query.list();
    final Procedure1<RCProject> _function = new Procedure1<RCProject>() {
        public void apply(final RCProject it) {
          it.setLor(Boolean.valueOf(false));
          it.updateLORInfo();
        }
      };
    IterableExtensions.<RCProject>forEach(_list, _function);
  }
  
  public void directCostFunction() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.directCostRequestFunction");
          it.setName("\u8D39\u7528\u8C03\u6574");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);
  }
  
  public void markFaultReport() {IGenericQuery<RCFaultReport> query=getObjectFactory().createGenericQuery(RCFaultReport.class,"select e from com.shrct.businessprocess.customerservice.impl.RCFaultReportImpl as e   where  e.active = 1      ");
    Collection<RCFaultReport> _list = query.list();
    final Procedure1<RCFaultReport> _function = new Procedure1<RCFaultReport>() {
        public void apply(final RCFaultReport it) {
          it.setMarked(Boolean.valueOf(false));
        }
      };
    IterableExtensions.<RCFaultReport>forEach(_list, _function);
  }
  
  public void markFunctions() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.createRequest");
          it.setName("\u5BA2\u6237\u62A5\u4FEE");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);AppFunction appFunction_1=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_1 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.processRequest");
          it.setName("\u5904\u7406\u62A5\u4FEE");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_1, _function_1);AppFunction appFunction_2=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_2 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.pendRequest");
          it.setName("\u6302\u8D77");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_2, _function_2);AppFunction appFunction_3=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_3 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.resumeRequest");
          it.setName("\u53D6\u6D88\u6302\u8D77");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_3, _function_3);AppFunction appFunction_4=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_4 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.requireRMARequest");
          it.setName("\u9700CASE RMA");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_4, _function_4);AppFunction appFunction_5=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_5 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.finishRMARequest");
          it.setName("CASE RMA\u5B8C\u6210");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_5, _function_5);AppFunction appFunction_6=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_6 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.showEngineerReports");
          it.setName("\u67E5\u770B\u65E5\u5FD7");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_6, _function_6);AppFunction appFunction_7=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_7 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.deleteRequest");
          it.setName("\u5220\u9664\u62A5\u4FEE");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_7, _function_7);AppFunction appFunction_8=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_8 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.modifyRequest");
          it.setName("\u4FEE\u6539\u62A5\u4FEE");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_8, _function_8);AppFunction appFunction_9=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_9 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.assignRequest");
          it.setName("\u6D3E\u5DE5");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_9, _function_9);AppFunction appFunction_10=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_10 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.reportFinishRequest");
          it.setName("CASE\u5B8C\u6210");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_10, _function_10);AppFunction appFunction_11=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_11 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.appendInfoRequest");
          it.setName("\u8FFD\u52A0\u4FE1\u606F");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_11, _function_11);AppFunction appFunction_12=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_12 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.client.faultreport.MarkedFaultReportManagementPresenter.attachServiceRecordsRequest");
          it.setName("\u5173\u8054\u670D\u52A1\u5355");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_12, _function_12);AppFunction appFunction_13=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_13 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.customerService");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.ShowEngineerWorkbenchCommand4Marked");
          it.setName("\u6807\u8BB0\u5DE5\u7A0B\u5E08\u5DE5\u4F5C\u53F0");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_13, _function_13);AppFunction appFunction_14=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_14 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.customerService");
          it.setFunctionId("com.shrct.businessprocess.web.markedFaultReportManagementPresenter");
          it.setName("\u6807\u8BB0CASE\u670D\u52A1\u7BA1\u7406");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_14, _function_14);
  }
  
  public void initPaymentConfig() {IGenericQuery<RCSalesCommissionYearConfig> query=getObjectFactory().createGenericQuery(RCSalesCommissionYearConfig.class,"select e from com.shrct.businessprocess.project.impl.RCSalesCommissionYearConfigImpl as e   where  e.active = 1      ");
    Collection<RCSalesCommissionYearConfig> _list = query.list();
    final Procedure1<RCSalesCommissionYearConfig> _function = new Procedure1<RCSalesCommissionYearConfig>() {
        public void apply(final RCSalesCommissionYearConfig commissionConfig) {RCSaleCommissionYearPayment rCSaleCommissionYearPayment=RCSaleCommissionYearPaymentImpl.create(getObjectFactory());
          final Procedure1<RCSaleCommissionYearPayment> _function = new Procedure1<RCSaleCommissionYearPayment>() {
              public void apply(final RCSaleCommissionYearPayment it) {
                RCCommissionYearConfig _overallConfig = commissionConfig.getOverallConfig();
                Integer _year = _overallConfig.getYear();
                it.setYear(_year);
                RCSalesAssignment _saler = commissionConfig.getSaler();
                it.setSaler(_saler);
              }
            };
          ObjectExtensions.<RCSaleCommissionYearPayment>operator_doubleArrow(rCSaleCommissionYearPayment, _function);
        }
      };
    IterableExtensions.<RCSalesCommissionYearConfig>forEach(_list, _function);
  }
  
  public void employeeLeaveData() {IGenericQuery<RCEmployee> query=getObjectFactory().createGenericQuery(RCEmployee.class,"select e from com.shrct.businessprocess.organization.impl.RCEmployeeImpl as e   where  e.active = 1      ");
    Collection<RCEmployee> _list = query.list();
    final Procedure1<RCEmployee> _function = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setIsLeave(Boolean.valueOf(false));
        }
      };
    IterableExtensions.<RCEmployee>forEach(_list, _function);
  }
  
  public void order349CancelClose() {
    IGenericQuery<RCPurchaseOrder> query=getObjectFactory().createGenericQuery(RCPurchaseOrder.class,"select e from com.shrct.businessprocess.purchase.impl.RCPurchaseOrderImpl as e   where ((e.orderNumber) = ( '150327' )) and  e.active = 1      ");
    RCPurchaseOrder _uniqueResult = query.uniqueResult();
    _uniqueResult.cancelClose();
  }
  
  public void defaultServiceLevel() {RCServiceLevel rCServiceLevel=RCServiceLevelImpl.create(getObjectFactory());
    final Procedure1<RCServiceLevel> _function = new Procedure1<RCServiceLevel>() {
        public void apply(final RCServiceLevel it) {
          it.setCodeid("DEF");
          it.setName("\u5F85\u786E\u5B9A");
        }
      };
    ObjectExtensions.<RCServiceLevel>operator_doubleArrow(rCServiceLevel, _function);
  }
  
  public void performTest10() {
    final String projectId = "2015048";
    IGenericQuery<RCProject> query=getObjectFactory().createGenericQuery(RCProject.class,"select e from com.shrct.businessprocess.project.impl.RCProjectImpl as e   where ((e.code) = (:projectId)) and  e.active = 1      ").setParameter("projectId",projectId);
    Collection<RCProject> _list = query.list();
    final Procedure1<RCProject> _function = new Procedure1<RCProject>() {
        public void apply(final RCProject it) {
          RCProjectMoney _totalRealEfc = it.getTotalRealEfc();
          Double _amount = _totalRealEfc.getAmount();
          InputOutput.<Double>println(_amount);
        }
      };
    IterableExtensions.<RCProject>forEach(_list, _function);
  }
  
  public void nullProjectExtnsion() {
    IGenericQuery<RCProject> query=getObjectFactory().createGenericQuery(RCProject.class,"select e from com.shrct.businessprocess.project.impl.RCProjectImpl as e   where (e.typeExtension IS   NULL ) and  e.active = 1      ");
    Collection<RCProject> _list = query.list();
    final Procedure1<RCProject> _function = new Procedure1<RCProject>() {
        public void apply(final RCProject it) {
          V_0_2.this.projectTypeExtensionDAO.asDeliver(it);
        }
      };
    IterableExtensions.<RCProject>forEach(_list, _function);
  }
  
  public void projectExtension11() {IGenericQuery<RCProject> query=getObjectFactory().createGenericQuery(RCProject.class,"select e from com.shrct.businessprocess.project.impl.RCProjectImpl as e   where  e.active = 1      ");
    Collection<RCProject> _list = query.list();
    final Procedure1<RCProject> _function = new Procedure1<RCProject>() {
        public void apply(final RCProject it) {
          String _code = it.getCode();
          String _plus = ("====>updateinfo for:" + _code);
          InputOutput.<String>println(_plus);
          V_0_2.this.projectTypeExtensionDAO.asDeliver(it);
          Boolean _passed = it.getPassed();
          if ((_passed).booleanValue()) {
            RCProjectStat _stat = it.getStat();
            _stat.updateInfo();
          }
        }
      };
    IterableExtensions.<RCProject>forEach(_list, _function);
  }
  
  public void customerContractRate() {IGenericQuery<RCCustomerContract> query=getObjectFactory().createGenericQuery(RCCustomerContract.class,"select e from com.shrct.businessprocess.project.impl.RCCustomerContractImpl as e   where  e.active = 1      ");
    Collection<RCCustomerContract> _list = query.list();
    final Procedure1<RCCustomerContract> _function = new Procedure1<RCCustomerContract>() {
        public void apply(final RCCustomerContract it) {
          it.setServiceAmount(Double.valueOf(0d));
        }
      };
    IterableExtensions.<RCCustomerContract>forEach(_list, _function);
  }
  
  public void ebupdater() {
    IGenericQuery<RCProjectCreditStat> query=getObjectFactory().createGenericQuery(RCProjectCreditStat.class,"select s from com.shrct.businessprocess.project.impl.RCProjectCreditStatImpl as s   where (((s.project.earlyBuildInfo.isEarlyBuild) = (true)) and ((s.isInitializedAsEB) = (false))) and  s.active = 1      ");
    Collection<RCProjectCreditStat> _list = query.list();
    final Procedure1<RCProjectCreditStat> _function = new Procedure1<RCProjectCreditStat>() {
        public void apply(final RCProjectCreditStat it) {
          it.setIsInitializedAsEB(Boolean.valueOf(true));
          Date _ebCancelDate = it.getEbCancelDate();
          boolean _equals = Objects.equal(_ebCancelDate, null);
          if (_equals) {
            it.setIsCurrentEB(Boolean.valueOf(true));
          }
        }
      };
    IterableExtensions.<RCProjectCreditStat>forEach(_list, _function);
  }
  
  public void salePerformenceFunction() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.process");
          it.setFunctionId("com.shrct.businessprocess.web.ShowProjectSaleAssignmentManagementCommand");
          it.setName("\u9500\u552E\u4E1A\u7EE9\u67E5\u8BE2");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);
  }
  
  public void projectExtensionType() {IGenericQuery<RCProjectTypeExtension> query=getObjectFactory().createGenericQuery(RCProjectTypeExtension.class,"select e from com.shrct.businessprocess.project.impl.RCProjectTypeExtensionImpl as e   where  e.active = 1      ");
    Collection<RCProjectTypeExtension> _list = query.list();
    final Procedure1<RCProjectTypeExtension> _function = new Procedure1<RCProjectTypeExtension>() {
        public void apply(final RCProjectTypeExtension it) {
          it.initType();
        }
      };
    IterableExtensions.<RCProjectTypeExtension>forEach(_list, _function);
  }
  
  public void projectConfirmDate_01() {IGenericQuery<RCProject> query=getObjectFactory().createGenericQuery(RCProject.class,"select e from com.shrct.businessprocess.project.impl.RCProjectImpl as e   where  e.active = 1      ");
    Collection<RCProject> _list = query.list();
    final Procedure1<RCProject> _function = new Procedure1<RCProject>() {
        public void apply(final RCProject it) {
          RCProjectTypeExtension _typeExtension = it.getTypeExtension();
          if ((_typeExtension instanceof RCProjectServiceDeliver)) {
            RCProjectTypeExtension _typeExtension_1 = it.getTypeExtension();
            Date _deliverDate = it.getDeliverDate();
            ((RCProjectServiceDeliver) _typeExtension_1).setConfirmDate(_deliverDate);
          }
        }
      };
    IterableExtensions.<RCProject>forEach(_list, _function);
  }
  
  public void projectBehavior() {IGenericQuery<RCProject> query=getObjectFactory().createGenericQuery(RCProject.class,"select e from com.shrct.businessprocess.project.impl.RCProjectImpl as e   where  e.active = 1      ");
    Collection<RCProject> _list = query.list();
    final Procedure1<RCProject> _function = new Procedure1<RCProject>() {
        public void apply(final RCProject it) {
          it.start();
        }
      };
    IterableExtensions.<RCProject>forEach(_list, _function);
  }
  
  public void addCreateAllTaskConfirmedDataCommand1() {
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
        }
      };
    this.appFunctionService.createOrUpdateAppFunction(
      "com.shrct.businessprocess.web.projectManagement", 
      "com.shrct.businessprocess.web.CreateAllTaskConfirmedDataCommand", 
      "\u5B8C\u6210\u9A8C\u6536", _function);
  }
  
  public void initFunctions4Remove() {IGenericQuery<AppFunction> query=getObjectFactory().createGenericQuery(AppFunction.class,"select e from edu.fudan.langlab.domain.security.impl.AppFunctionImpl as e   where  e.active = 1      ");
    Collection<AppFunction> _list = query.list();
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setRemoved(Boolean.valueOf(false));
        }
      };
    IterableExtensions.<AppFunction>forEach(_list, _function);
  }
  
  public void initProjectAndOrderId() {
    this.parameterService.setOrderYear(Integer.valueOf(2017));
    this.parameterService.setProjectYear(Integer.valueOf(2017));
  }
  
  public void c() {
    IGenericQuery<RCPurchaseOrder> query=getObjectFactory().createGenericQuery(RCPurchaseOrder.class,"select e from com.shrct.businessprocess.purchase.impl.RCPurchaseOrderImpl as e   where ((e.orderNumber) = ( '160460' )) and  e.active = 1      ");
    RCPurchaseOrder _uniqueResult = query.uniqueResult();
    final Procedure1<RCPurchaseOrder> _function = new Procedure1<RCPurchaseOrder>() {
        public void apply(final RCPurchaseOrder it) {
          it.cancelClose();
        }
      };
    ObjectExtensions.<RCPurchaseOrder>operator_doubleArrow(_uniqueResult, _function);
  }
  
  @Autowired
  private UpdateServie updateService;
  
  public void doUpgrade() {
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "setRCIdentifiableProductInStockEventQuantityTo1")) {
    	setRCIdentifiableProductInStockEventQuantityTo1();
    	updateService.updaterCommited("V_0_2", "V_0_2", "setRCIdentifiableProductInStockEventQuantityTo1");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "setIdentifiableProductCountTo1")) {
    	setIdentifiableProductCountTo1();
    	updateService.updaterCommited("V_0_2", "V_0_2", "setIdentifiableProductCountTo1");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "initTaxRate")) {
    	initTaxRate();
    	updateService.updaterCommited("V_0_2", "V_0_2", "initTaxRate");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "functions20150420")) {
    	functions20150420();
    	updateService.updaterCommited("V_0_2", "V_0_2", "functions20150420");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "remainAmount")) {
    	remainAmount();
    	updateService.updaterCommited("V_0_2", "V_0_2", "remainAmount");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "RCProjectReference")) {
    	RCProjectReference();
    	updateService.updaterCommited("V_0_2", "V_0_2", "RCProjectReference");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "SalesFunction")) {
    	SalesFunction();
    	updateService.updaterCommited("V_0_2", "V_0_2", "SalesFunction");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "invoiceToRealMoney1")) {
    	invoiceToRealMoney1();
    	updateService.updaterCommited("V_0_2", "V_0_2", "invoiceToRealMoney1");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "RCPayRequestInfoUpdate1")) {
    	RCPayRequestInfoUpdate1();
    	updateService.updaterCommited("V_0_2", "V_0_2", "RCPayRequestInfoUpdate1");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "addFunction20150525")) {
    	addFunction20150525();
    	updateService.updaterCommited("V_0_2", "V_0_2", "addFunction20150525");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "allTaskDelivered")) {
    	allTaskDelivered();
    	updateService.updaterCommited("V_0_2", "V_0_2", "allTaskDelivered");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "RCFaultReportLevel")) {
    	RCFaultReportLevel();
    	updateService.updaterCommited("V_0_2", "V_0_2", "RCFaultReportLevel");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "finishDeliverFunction")) {
    	finishDeliverFunction();
    	updateService.updaterCommited("V_0_2", "V_0_2", "finishDeliverFunction");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "creditStat4CurrentSalerCommandFunction")) {
    	creditStat4CurrentSalerCommandFunction();
    	updateService.updaterCommited("V_0_2", "V_0_2", "creditStat4CurrentSalerCommandFunction");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "RCProjectReference4CustomerReference")) {
    	RCProjectReference4CustomerReference();
    	updateService.updaterCommited("V_0_2", "V_0_2", "RCProjectReference4CustomerReference");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "RCSalesCommissionYearConfigLastSettlement")) {
    	RCSalesCommissionYearConfigLastSettlement();
    	updateService.updaterCommited("V_0_2", "V_0_2", "RCSalesCommissionYearConfigLastSettlement");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "LOR_1")) {
    	LOR_1();
    	updateService.updaterCommited("V_0_2", "V_0_2", "LOR_1");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "directCostFunction")) {
    	directCostFunction();
    	updateService.updaterCommited("V_0_2", "V_0_2", "directCostFunction");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "markFaultReport")) {
    	markFaultReport();
    	updateService.updaterCommited("V_0_2", "V_0_2", "markFaultReport");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "markFunctions")) {
    	markFunctions();
    	updateService.updaterCommited("V_0_2", "V_0_2", "markFunctions");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "initPaymentConfig")) {
    	initPaymentConfig();
    	updateService.updaterCommited("V_0_2", "V_0_2", "initPaymentConfig");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "employeeLeaveData")) {
    	employeeLeaveData();
    	updateService.updaterCommited("V_0_2", "V_0_2", "employeeLeaveData");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "order349CancelClose")) {
    	order349CancelClose();
    	updateService.updaterCommited("V_0_2", "V_0_2", "order349CancelClose");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "defaultServiceLevel")) {
    	defaultServiceLevel();
    	updateService.updaterCommited("V_0_2", "V_0_2", "defaultServiceLevel");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "performTest10")) {
    	performTest10();
    	updateService.updaterCommited("V_0_2", "V_0_2", "performTest10");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "nullProjectExtnsion")) {
    	nullProjectExtnsion();
    	updateService.updaterCommited("V_0_2", "V_0_2", "nullProjectExtnsion");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "projectExtension11")) {
    	projectExtension11();
    	updateService.updaterCommited("V_0_2", "V_0_2", "projectExtension11");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "customerContractRate")) {
    	customerContractRate();
    	updateService.updaterCommited("V_0_2", "V_0_2", "customerContractRate");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "ebupdater")) {
    	ebupdater();
    	updateService.updaterCommited("V_0_2", "V_0_2", "ebupdater");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "salePerformenceFunction")) {
    	salePerformenceFunction();
    	updateService.updaterCommited("V_0_2", "V_0_2", "salePerformenceFunction");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "projectExtensionType")) {
    	projectExtensionType();
    	updateService.updaterCommited("V_0_2", "V_0_2", "projectExtensionType");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "projectConfirmDate_01")) {
    	projectConfirmDate_01();
    	updateService.updaterCommited("V_0_2", "V_0_2", "projectConfirmDate_01");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "projectBehavior")) {
    	projectBehavior();
    	updateService.updaterCommited("V_0_2", "V_0_2", "projectBehavior");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "addCreateAllTaskConfirmedDataCommand1")) {
    	addCreateAllTaskConfirmedDataCommand1();
    	updateService.updaterCommited("V_0_2", "V_0_2", "addCreateAllTaskConfirmedDataCommand1");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "initFunctions4Remove")) {
    	initFunctions4Remove();
    	updateService.updaterCommited("V_0_2", "V_0_2", "initFunctions4Remove");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "initProjectAndOrderId")) {
    	initProjectAndOrderId();
    	updateService.updaterCommited("V_0_2", "V_0_2", "initProjectAndOrderId");
    }
    if (updateService.canPerformUpdate("V_0_2", "V_0_2", "c")) {
    	c();
    	updateService.updaterCommited("V_0_2", "V_0_2", "c");
    }
    
  }
}
